package com.certificationManager.server.domain.model;

import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

/**
 * @author Benjamin Barbier
 *
 * Keys : http://code.google.com/intl/fr-FR/appengine/docs/java/datastore/creatinggettinganddeletingdata.html#Keys
 * Mapping JPA: http://www.datanucleus.org/products/accessplatform_2_2/jpa/annotations.html
 *
 */
@PersistenceCapable
public class Language {
	
    @PrimaryKey
    private Key key;
	
    @Persistent
	private String code;
	
	@Persistent
	private String name;
	
    /**
     * Constructor
     * 
     * @param code : "FR","EN",...
     * @param name : "Français","English",...
     */
    public Language(String code, String name) {
    	this.key = KeyFactory.createKey(Language.class.getSimpleName(), code);
    	this.code = code;
		this.name = name;
	}
    
    public Language() {}
    
	public void setKey(Key key) {
		this.key = key;
	}

	public Key getKey() {
		return key;
	}
    
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
